import datetime
import os
from peewee import *
from db.user import User

if not os.path.exists('./data'):
    os.mkdir('./data')


class Article(Model):
    id = CharField(primary_key=True, max_length=40)
    title = CharField(null=False, max_length=50)
    date = DateTimeField(null=False, default=datetime.datetime.now())
    path = CharField(null=False)
    comments = CharField(default='True', max_length=6)
    read_count = IntegerField(default=0)
    comment_count = IntegerField(default=0)
    like_count = IntegerField(default=0)
    repost_count = IntegerField(default=0)
    etag = CharField(default='', max_length=50)
    content = TextField(default='')
    html = TextField(default='')
    descripition = TextField(default='')
    tags = TextField(default='')
    list_etag = CharField(default='', max_length=50)

    class Meta:
        database = User.db


class Static(Model):
    key = CharField(primary_key=True, default='')
    value = CharField(default='')

    class Meta:
        database = User.db
